package com.mjk.common.ai.work.admin;

import com.mjk.common.ai.dto.ConvPresetAddReq;
import com.mjk.common.ai.dto.ConvPresetEditReq;
import com.mjk.common.ai.dto.ConvPresetSearchReq;
import com.mjk.common.ai.entity.ConversationPreset;
import com.mjk.common.ai.service.ConversationPresetService;
import com.mjk.common.base.error.BeeError;
import com.mjk.common.base.response.BeeResponse;
import com.mjk.common.base.work.BaseWork;
import com.mjk.common.base.work.annotation.BeeWork;
import com.mjk.common.core.jdbc.bean.BeePage;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@BeeWork(work = "convprest")
public class AdminConvPrestWork extends BaseWork {

    @Resource
    private ConversationPresetService conversationPresetService;


    public BeeResponse getConvPrestList(ConvPresetSearchReq req) {
        return BeeError.BEE_SUC.tranceError(conversationPresetService.search(req.getTitle(), req.getPageStart(), req.getPageSize()));
    }

    public BeeResponse addConvPrest(ConvPresetAddReq presetAddReq) {
        conversationPresetService.addOne(presetAddReq);
        return BeeError.BEE_SUC.tranceError();
    }

    public BeeResponse editConvPrest(ConvPresetEditReq editReq) {
        needParams(editReq, ConvPresetEditReq::getUuid);
        conversationPresetService.edit(editReq);
        return BeeError.BEE_SUC.tranceError();
    }

    public BeeResponse delConvPrest(ConvPresetEditReq editReq) {
        conversationPresetService.softDel(editReq.getUuid());
        return BeeError.BEE_SUC.tranceError();
    }

}
